﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace PingSwitch
{
    public partial class frmNotify : Form
    {
        public frmNotify()
        {
            InitializeComponent();
        }

        public frmNotify(string message)
        {
            InitializeComponent();
            formatText(message);
            System.Media.SystemSounds.Exclamation.Play();
        }

        private void formatText(string message)
        {
            string[] words = message.Split('#');
            // words[0] = hostname
            // words[1] = message
            // words[2] = color
            // Cast string to color
            Color color = Color.FromName(words[2]);
            rtbHost.Text = words[0];
            rtbHost.ForeColor = color;
            rtbHost.SelectionAlignment = HorizontalAlignment.Center;
            rtbMessage.Text = words[1];
            rtbMessage.SelectionAlignment = HorizontalAlignment.Center;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            this.Close();                                        
        }

        private void copyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            rtbHost.Copy();
        }
    }
}
